package com.olive.controller;

import java.util.HashMap;
import java.util.Map;

import com.olive.service.StudentService;
import com.olive.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.olive.entity.StudentDO;
import com.olive.entity.TeacherDO;
import com.olive.mapper.StudentMapper;
import com.olive.mapper.TeacherMapper;

@RestController
public class TestController {
	
	@Autowired
	StudentService studentService;

	@Autowired
	TeacherService teacherService;
	
	@GetMapping("/testMybatis")
	public Map<String, Object> testMybatis(){
		StudentDO studentDO = new StudentDO();
		studentDO.setName("BUG弄潮儿");
		studentDO.setSex(1);
		studentDO.setGrade("一年级");
		studentService.save(studentDO);

		TeacherDO teacherDO = new TeacherDO();
		teacherDO.setName("Java乐园");
		teacherDO.setSex(2);
		teacherDO.setOffice("语文");
		teacherService.save(teacherDO);
		
		Map<String, Object> result = new HashMap<>();
		result.put("code", "000000");
		return result;
	}

}
